package edu.nf.utils.handler;

import edu.nf.utils.RowProcessor;

import java.sql.ResultSet;
import java.sql.SQLException;

public class ColumnListHandler<T> extends AbstractListHandler<T>{

    private int index;
    private Class<T> clazz;

    public ColumnListHandler(int index, Class<T> clazz){
        this.index = index;
        this.clazz = clazz;
    }

    @Override
    protected T getRow(ResultSet rs) throws SQLException {
        return rs.next()? RowProcessor.toColumn(rs,index,clazz):null;
    }
}
